#include <iostream>
using namespace std;
int a[100005];
int main()
{
    int n;
    cin >> n;
    for (int i = 1; i <= n; i++)
    {
        cin >> a[i];
    }
    long long h = 0, x = 1, Hxma = -1, k = 1;
    for (int i = 1; i <= n;)
    {
        long long sum = 0;
        int j = x;
        while (j-- && i <= n)
        {
            sum += a[i];
            i++;
        }
        //cout << sum << " ";
        if (sum > Hxma)
        {
            Hxma = sum;
            h = k;
        }
        x = x * 2;
        k++;
    }
    cout << h << endl;
    return 0;
}